﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Master.Master" AutoEventWireup="true" CodeBehind="HRMKeyPerformanceAreaList.aspx.cs" Inherits="KPIS.GERP.GHRMS.APP.App_UI.Forms.ViView" %>
<%@ Register src="../Controls/user.ascx" tagname="user" tagprefix="uc1" %>
<%@ Register src="../Controls/DatePicker.ascx" tagname="DatePicker" tagprefix="uc2" %> 
      
<asp:Content ID="Content1" runat="server" contentplaceholderid="ContentPlaceHolder1">
    <script src="../../Resources/Scripts/jquery-1.9.0.min.js" type="text/javascript"></script>
<telerik:RadCodeBlock ID="RadCodeBlock1" runat="server">
    <script type="text/javascript">

        function ItemClicked(kpa_seq, pos_seq, key_area) {
            radopen("HRMKeyPerformanceAreaList_POP.aspx?KPASeq=" + kpa_seq + "&PosSeq=" + pos_seq + "&KeyArea=" + key_area + "&Mode=" + "Edit", "POP");
            return false;
        }

        function closeRadWindow(oWnd, args) {
            $find('<%= RadAjaxManager1.ClientID %>').ajaxRequest();
        }

    </script>
 </telerik:RadCodeBlock>

  <telerik:RadWindowManager 
        ID="RadWindowManager1" 
        ShowContentDuringLoad="false" 
        VisibleStatusbar="false" 
        ReloadOnShow="true" 
        runat="server" 
        Skin="Web20" 
        Modal="true" 
        KeepInScreenBounds="true" 
        Style="z-index: 7000">
        <Windows>
            <telerik:RadWindow 
                ID="POP" 
                runat="server" 
                Width="1000px" 
                Behaviors="Reload, Close" OnClientClose="closeRadWindow" >
            </telerik:RadWindow>
        </Windows>
</telerik:RadWindowManager>

    <title>โครงสร้างกรอบอัตรากำลัง</title>
    <link href="../../Styles/CssClass.css" rel="stylesheet" type="text/css" />
    
    <telerik:RadAjaxManager ID="RadAjaxManager1" runat="server" onAjaxReQuest="RadManager1_AjaxReQuest">
        <AjaxSettings>
            <telerik:AjaxSetting AjaxControlID="imbSearch">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="cmbEmpType">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="PanelGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="txtPosition" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="txtPositionName" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="lbnAddNew" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadTreeView">
                <UpdatedControls>
                    <telerik:AjaxUpdatedControl ControlID="RadTreeView" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="PanelGrid" LoadingPanelID="RadAjaxLoadingPanel1" />
                    <telerik:AjaxUpdatedControl ControlID="Panel5" LoadingPanelID="RadAjaxLoadingPanel1" />
                </UpdatedControls>
            </telerik:AjaxSetting>
            <telerik:AjaxSetting AjaxControlID="RadAjaxManager1">
                <UpdatedControls> 
                    <telerik:AjaxUpdatedControl ControlID="RadGridKeyArea" />         
                    <telerik:AjaxUpdatedControl ControlID="ltrMessageError" />                 
                </UpdatedControls> 
            </telerik:AjaxSetting>
        </AjaxSettings>
    </telerik:RadAjaxManager>

    <asp:HiddenField ID="hdfPosSeq" runat="server" Value=""/>

    <asp:panel ID="Panel6" runat="server" CssClass="contentPanelPaddingTop5px">
    <table width="1000" cellpadding="0" cellspacing="0">
        <tr>
            <td width="280" valign="top">
                <div class="Background980V3" style="width: 270px; min-height: 440px; margin-right:10px">
                    <table width="100%">
                        <tr class ="tableHeader">
                            <td class ="tableHeader" valign="middle">
                                ค้นหา : <telerik:RadTextBox ID="txtSearch" Runat="server" Width="140px"  />
                                    <asp:ImageButton ID="imbSearch" runat="server" onclick="imbSearch_Click" 
                                    ToolTip="กดปุ่มเพื่อเริ่มค้นหาข้อมูล" ImageUrl="~/App_UI/Images/Buttons/Magnifier.gif" />

                            </td>
                        </tr>
                    </table>
                    <asp:Panel ID="Panel2" runat="server" Width="100%" Height="100%" ScrollBars="Auto">
                        <telerik:RadTreeView ID="RadTreeView" runat="server" 
                            DataFieldID="Id" 
                            DataFieldParentID="Parent_id" 
                            DataTextField="Name" 
                            DataValueField="Id" 
                            onnodeclick="RadTreeView_NodeClick" OnNodeExpand="RadTreeView_NodeExpand" >
                        </telerik:RadTreeView>
                    </asp:Panel>
                </div>
            </td>
            <td valign = "top">
            <div class="Background980V3" style="width: 680px; margin-bottom: 5px; ">
             <asp:Panel ID="PanelFilter" runat="server" Width="700px" ScrollBars="Auto">
                <table align = "center" width = "650px">
                    <tr>
                        <td align="right" >
                            ประเภทบุคลากร : </td>
                        <td align = "left">
                        <telerik:RadComboBox 
                            ID="cmbEmpType" 
                            DataTextField = "Name"
                            DataValueField = "Sequence"
                            AllowCustomText="true" 
                            runat="server" 
                            Width="200px"
                            Filter ="Contains"
                            AutoPostBack="True"
                            CausesValidation ="false"
                            ValidationGroup = "EmpType"
                            EmptyMessage="... เลือกประเภทบุคลากร ..." 
                            onselectedindexchanged="cmbEmpType_SelectedIndexChanged" >
                        </telerik:RadComboBox>
                        </td>
                        
                       <td>&nbsp;</td>
                    </tr>
                </table>
            </asp:Panel>
            </div> 
            <div class="Background980V3" style="width:690px; min-height: 413px; padding: 0px 5px 0px 5px;"> 
                <asp:Panel ID="Panel1" runat="server"  Width="100%" >
                    <table width="100%" >
                        <tr>
                            <td class = "tableHeader" style="height: 10px; padding: 0px 0px 0px 0px;" >
                                <asp:Panel ID="Panel5" runat="server"  Width="100%" >
                                    <table><tr>
                                        <td>
                                            <asp:Label ID="txtPosition" runat="server" Text="ตำแหน่ง : " Visible="false"></asp:Label>
                                        </td>
                                        <td>
                                            <asp:Label ID="txtPositionName" runat="server" Visible="false"></asp:Label>
                                        </td>
                                        <td width="20px"></td>
                                        <td>
                                            <asp:LinkButton ID="lbnAddNew" runat="server" style="margin-right:20px;"   
                                                onclick="cmdAddNew_Click" Font-Overline="False" Font-Underline="False" Enabled="false" >
                                                <img style="border:0px;vertical-align:middle;" alt="" src="../Images/Buttons/AddRecord.gif" />
                                                &nbsp;<span style="text-decoration:underline">เพิ่มข้อมูล KPA</span>
                                            </asp:LinkButton> 
                                        </td>  
                                    </tr>
                                    </table>
                                </asp:Panel>
                            </td>
                        </tr>
                        <tr>
                            <td>
                                <asp:Panel ID="PanelGrid" runat="server" Height="330px" ScrollBars="Auto" 
                                    Width="690px">
                                    

                                <asp:Panel ID="PanelDetail" runat="server" Width = "690px" ScrollBars ="Auto">
                                    <table width = "650" align ="center" >
                                        
                                        <tr>    
                                            <td colspan = "2">
                                                <telerik:RadGrid ID="RadGridKeyArea" runat="server" Width="100%" AutoGenerateColumns="false"
                                                    OnItemCommand="RadGridKeyArea_ItemCommand" Visible="false" >
                                                <MasterTableView AllowMultiColumnSorting="True" CellSpacing="-1" 
                                                    EditMode="PopUp" DataKeyNames="kpa_seq" ClientDataKeyNames="kpa_seq" 
                                                    InsertItemPageIndexAction="ShowItemOnCurrentPage" 
                                                    NoMasterRecordsText="&lt; ไม่มีข้อมูล &gt;">
                                                    <Columns>
                                                        <telerik:GridTemplateColumn AllowFiltering="false" visible="true" >
                                                            <HeaderStyle HorizontalAlign="Center" Width="30px" />
                                                            <ItemTemplate>
                                                                <asp:ImageButton ID="btnEdit" runat="server" BorderWidth="0px"
                                                                     OnClientClick='<%# String.Format("ItemClicked({0},{1},{2})",Eval("kpa_seq"),Eval("pos_seq"),Eval("key_area_seq")) %>' 
                                                                    ImageUrl="../Images/Buttons/Edit.gif" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridTemplateColumn AllowFiltering="false" visible="true" >
                                                            <HeaderStyle HorizontalAlign="Center" Width="30px" />
                                                            <ItemTemplate>
                                                                <asp:ImageButton ID="btnDelete" runat="server" BorderWidth="0px" 
                                                                    OnClientClick="javascript:return confirm('ต้องการลบข้อมูลใช่หรือไม่')" CommandName="btnDelete"
                                                                    ImageUrl="../Images/Buttons/Delete.gif" />
                                                            </ItemTemplate>
                                                        </telerik:GridTemplateColumn>
                                                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" HeaderStyle-Width="400px" Visible="false" 
                                                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" DataField="key_area_seq"
                                                            HeaderText="key_area">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" HeaderStyle-Width="400px" 
                                                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" DataField="key_area_name"
                                                            HeaderText="ขอบเขตความรับผิดชอบหลัก">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" HeaderStyle-Width="300px" 
                                                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" DataField="description" 
                                                            HeaderText="รายละเอียดงาน">
                                                        </telerik:GridBoundColumn>
                                                        <telerik:GridBoundColumn AutoPostBackOnFilter="true" HeaderStyle-Width="250px" ItemStyle-HorizontalAlign="Right" 
                                                            HeaderStyle-Font-Bold="true" HeaderStyle-HorizontalAlign="Center" DataField="weight" 
                                                            HeaderText="น้ำหนัก(%)">
                                                        </telerik:GridBoundColumn>
                                                    </Columns>
                                                </MasterTableView>
                                                </telerik:RadGrid>
                                                <span style="font-size: x-small; color:red">
                                                     
                                                    <asp:Literal runat="server" ID="ltrMessageError"  />
                                                </span>
                                            </td>
                                        </tr>
                                    </table>
                                </asp:Panel>

                                </asp:Panel>
                            </td>
                        </tr>
                    </table>
                </asp:Panel>   
            </div>
        </td>
        </tr> 
    </table>
    </asp:panel>
</asp:Content>
